package demo.xlj.yuyi.studentapp.common;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import demo.xlj.yuyi.studentapp.R;
import demo.xlj.yuyi.studentapp.base.BaseRxActivity;
import demo.xlj.yuyi.studentapp.utils.ActivityUtil;
import demo.xlj.yuyi.studentapp.utils.SharePerferencesUtils;
import demo.xlj.yuyi.studentapp.utils.ToastUtil;

/**
 * 我的社团 界面
 */
public class MyCommicationActivity extends BaseRxActivity {

    @BindView(R.id.ImageView_back)
    ImageView mImageViewBack;
    @BindView(R.id.TextView_Title)
    TextView mTextViewTitle;
    @BindView(R.id.Textview_my_Commication_one)
    TextView mTextviewMyCommicationOne;
    @BindView(R.id.Textview_my_Commication_two)
    TextView mTextviewMyCommicationTwo;
    @BindView(R.id.Textview_my_Commication_three)
    TextView mTextviewMyCommicationThree;
    @BindView(R.id.Textview_my_Commication_four)
    TextView mTextviewMyCommicationFour;
    private String iswho = "99";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_commication);
        ButterKnife.bind(this);
        mTextViewTitle.setText("我    的");
        iswho = (String) SharePerferencesUtils.get(MyCommicationActivity.this, "isWho", "99", 0);

        switch (iswho) {
            case "99":
                mTextviewMyCommicationTwo.setVisibility(View.GONE);
                break;
            case "0":
                mTextviewMyCommicationTwo.setVisibility(View.GONE);
                break;

            case "1":
                mTextviewMyCommicationTwo.setVisibility(View.GONE);
                break;

            case "2":
                mTextviewMyCommicationTwo.setVisibility(View.GONE);
                break;

            case "3":

                break;
        }
    }

    @OnClick({R.id.ImageView_back, R.id.Textview_my_Commication_one, R.id.Textview_my_Commication_two,R.id.Textview_my_Commication_three, R.id.Textview_my_Commication_four})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ImageView_back:
                MyCommicationActivity.this.finish();
                break;
            case R.id.Textview_my_Commication_one:
                //退出登录
                SharePerferencesUtils.put(MyCommicationActivity.this, "isWho", "99", 0);//设置为99,然后呢
                setResult(88);
                MyCommicationActivity.this.finish();
                break;
            case R.id.Textview_my_Commication_two:
                //查看我申请的活动
                if (iswho.equals("99")) {
                    ToastUtil.error(MyCommicationActivity.this, "系统检测到您的身份有问题，请退出在登录", true, true);
                    return;
                } else {
                    if (iswho.equals("3")) {
                        ActivityUtil.openActivityFromLeftToRight(MyCommicationActivity.this, MyCommicationHuoDongActivity.class);
                    } else {
                        return;
                    }
                }
                break;
            case R.id.Textview_my_Commication_three:
                //查看我收藏的社团
                 ActivityUtil.openActivityFromLeftToRightByResult(MyCommicationActivity.this,CommunityStyleActivity.class,"type","1");
                break;
            case R.id.Textview_my_Commication_four:
                //查看我的发布
                ActivityUtil.openActivityFromLeftToRight(MyCommicationActivity.this,LookMyTongZhiActivity.class);
                break;

        }
    }

}
